package de.se2.sharebox.classes;

import static org.junit.Assert.*;

import java.util.Vector;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


/**
 * 
 * @author Gruppe 10
 *
 */
public class FolderJUnit
{
	private UserAccount userAccount;
	private Folder folder;
	private Vector<File> fileCollection;
	private Vector<Folder> folderCollection;
	Folder testFolder;
	File testFile;
	
	@Before
	public void setUp () 
	{
		fileCollection = new Vector<File>();
		folderCollection = new Vector<Folder>();
		userAccount = new UserAccount("Taty", "taty@test.de", "taty");
		fileCollection.add(new File("Test.txt", userAccount, 40));
		fileCollection.add(new File("Test.txt", userAccount, 50));
		folderCollection.add(new Folder("Test", userAccount, fileCollection, null));
		folderCollection.add(new Folder("Test", userAccount));
		testFolder = new Folder("Test2", userAccount);
		testFile = new File("TestFile.txt", userAccount, 50);
		
		folder = new Folder("MainFolder", userAccount, fileCollection, folderCollection);
	}
	
	@Test
	public void testExistFolderWithName() 
	{
		assertTrue(folder.existFolderWithName("Test"));
		assertFalse(folder.existFolderWithName("Abrakadabra"));
	}
	
	@Test
	public void testGetFolderByName() 
	{
		folder.addFolder(testFolder);
		assertEquals(testFolder, folder.getFolderByName("Test2"));
	}
	
	@Test
	public void testExistFileWithName() 
	{
		assertTrue(folder.existFileWithName("Test.txt"));
		assertFalse(folder.existFileWithName("Abrakadabra"));
	}
	
	@Test
	public void testGetFileByName() 
	{
		folder.addFile(testFile);
		assertEquals(testFile, folder.getFileByName("TestFile.txt"));
	}
	
	@Test
	public void testAddFile() 
	{
		
	}
	
	@Test
	public void testAddFolder() 
	{
		
	}
	
	@Test
	public void RemoveFile() 
	{
		
	}
	
	@Test
	public void removeFolder() 
	{
		
	}
	
	@After
	public void resetGlobal() 
	{
		userAccount = null;
		folder = null;
		fileCollection = null;
		folderCollection = null;
	}
}
